<template>
  <div class="tiny">
    <el-form v-model="form">
      <el-form-item label="标题">
        <el-input v-model="form.title"/>
      </el-form-item>

      <el-form-item style="width:100%">
        <TEditor ref="editor" v-model="form.content"/>
      </el-form-item>

      <el-form-item>
        <button @click="onSubmit">提交</button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import TEditor from '@/components/common/TEditor.vue'
import {ref} from 'vue'

var content = ref("请输入文本内容")

export default {
  components: {TEditor},
  data() {
    return {
      form: {
        "content": content.value,
        "title": "",
      }
    }
  },
  methods: {
    onSubmit() {
      console.log(this.form.content)
      CreateArticle(this.content)//axis后面的.get可以省略；
          .then(
              (response) => {
                this.data = response.data;
              })
          .catch(
              (error) => {
                console.log(error);
              });
    }
  },
}
</script>

<style scoped>
.tiny {
  padding: 0 25px;
}
</style>